package writer;

import java.io.*;

/**
 * @author 王艺锡
 * @version 1.0
 * 字符流
 * BufferedReader和BufferedWriter的使用
 */
public class BufferCopy_ {
    public static void main(String[] args) throws IOException {
        //注:BufferedReader和BufferedWriter是按照字符流进行操作，
        //所以不要去操作二进制文件(视频，图片等),
        //如果操作二进制文件，会造成文件损坏


        String srcFilePath = "e:\\BufferedWriter.txt";
        String destFilePath = "e:\\BufferedCopy.txt";
        BufferedReader bufferedReader = new BufferedReader(new FileReader(srcFilePath));
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(destFilePath));

        String line;
        while ((line = bufferedReader.readLine()) != null){
            bufferedWriter.write(line);
            bufferedWriter.newLine();
        }

        bufferedReader.close();
        bufferedWriter.close();

    }
}
